package com.yztstudy.Controller;

import com.yztstudy.Service.SearchService;
import com.yztstudy.param.ProductSearchParam;
import com.yztstudy.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 搜索的控制器
 */

@RestController
@RequestMapping("/search")
public class SearchController {

    @Autowired
    private SearchService searchService;


    /**
     * TODO 分页 + 分词 的商品搜索
     * @param productSearchParam
     * @return
     */
    @PostMapping("/product")
    public R searchProduct(@RequestBody ProductSearchParam productSearchParam)
    {
        return searchService.search(productSearchParam);
    }

}
